package com.wangshouyu.mp.pay.v3.transactions;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * @author 王守钰
 * @description 交易优惠功能
 * @date 2020/8/14 9:32
 */
public class TransactionsDetail implements Serializable {

    /**
     * 订单原价
     */
    @SerializedName(value = "cost_price")
    @JsonProperty(value = "cost_price")
    @JSONField(name = "cost_price")
    private Integer costPrice;

    /**
     * 商品小票ID
     */
    @SerializedName(value = "invoice_id")
    @JsonProperty(value = "invoice_id")
    @JSONField(name = "invoice_id")
    private String invoiceId;

    /**
     * 商品详情
     */
    @SerializedName(value = "goods_detail")
    @JsonProperty(value = "goods_detail")
    @JSONField(name = "goods_detail")
    private List<TransactionsGoodsDetail> goodsDetail;

    public Integer getCostPrice() {
        return costPrice;
    }

    public void setCostPrice(Integer costPrice) {
        this.costPrice = costPrice;
    }

    public String getInvoiceId() {
        return invoiceId;
    }

    public void setInvoiceId(String invoiceId) {
        this.invoiceId = invoiceId;
    }

    public List<TransactionsGoodsDetail> getGoodsDetail() {
        return goodsDetail;
    }

    public void setGoodsDetail(List<TransactionsGoodsDetail> goodsDetail) {
        this.goodsDetail = goodsDetail;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TransactionsDetail that = (TransactionsDetail) o;
        return Objects.equals(costPrice, that.costPrice) &&
                Objects.equals(invoiceId, that.invoiceId) &&
                Objects.equals(goodsDetail, that.goodsDetail);
    }

    @Override
    public int hashCode() {
        return Objects.hash(costPrice, invoiceId, goodsDetail);
    }

    @Override
    public String toString() {
        return "TransactionsDetail{" +
                "costPrice=" + costPrice +
                ", invoiceId='" + invoiceId + '\'' +
                ", goodsDetail=" + goodsDetail +
                '}';
    }
}
